import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { AuthController } from './auth.controller';
import { AuthService } from './auth.service';
import { PrismaService } from '../prisma/prisma.service';
import { UsersModule } from '../users/users.module'; // 导入 UsersModule
import { JwtStrategy } from './jwt.strategy';

@Module({
  imports: [
    // 注册 JWT 模块
    JwtModule.register({
      secret: 'xiaojie',
      signOptions: { expiresIn: '1h' },
    }),
    UsersModule, // 确保导入 UsersModule
  ],
  // 注册 AuthService、PrismaService 和 JwtStrategy
  providers: [AuthService, PrismaService, JwtStrategy],
  // 注册 AuthController
  controllers: [AuthController],
  // 导出 AuthService 和 JwtModule
  exports: [AuthService, JwtModule],
})
export class AuthModule {}
